package com.argticling.service;

import java.util.List;

import com.argticling.dao.interf.DublinCoreDAO;
import com.argticling.model.Article;
import com.argticling.model.DublinCore;

public class DublinCoreService {
    private DublinCoreDAO dublinCoreDAO;

    public void persist(DublinCore dublinCore) {
        dublinCoreDAO.persist(dublinCore);
    }

    public void delete(DublinCore dublinCore) {
        dublinCoreDAO.delete(dublinCore);
    }

    public List<DublinCore> getByAuthor(String authorId) {
        return dublinCoreDAO.getByAuthor(authorId);
    }

    public List<DublinCore> getBySection(String section) {
        return dublinCoreDAO.getBySection(section);
    }

    public List<DublinCore> getByDate(String date) {
        return dublinCoreDAO.getByDate(date);
    }

    public boolean completeDublinCore(DublinCore dublinCore) {
        //todo completar
        return true;
    }

    public boolean verifyFullDublinCore(DublinCore dublinCore) {
        return !(dublinCore.getContributor().equals("") || dublinCore.getCoverage().equals("") ||
                dublinCore.getCoverage().equals("") || dublinCore.getCreator().equals("") ||
                dublinCore.getDate().equals("") || dublinCore.getDescription().equals("") ||
                dublinCore.getFormat().equals("") || dublinCore.getId().equals("") ||
                dublinCore.getLanguage().equals("") || dublinCore.getPublisher().equals("") ||
                dublinCore.getRelation().equals("") || dublinCore.getRights() == null ||
                dublinCore.getSource().equals("") || dublinCore.getSubject().equals("") ||
                dublinCore.getTitle().equals("") || dublinCore.getType().equals(""));

    }

    public DublinCoreDAO getDublinCoreDAO() {
        return dublinCoreDAO;
    }

    public void setDublinCoreDAO(DublinCoreDAO dublinCoreDAO) {
        this.dublinCoreDAO = dublinCoreDAO;
    }

}
